﻿using System;
using System.Reflection;
using élénkPróbája.assets;

namespace élénkPróbája.validators
{
    public class ExceedValidator : AbstractComparisonValidator
    {
        public ExceedValidator(IComparable value) : base(value, () => Messages.greaterthan_error) {
        }

        public ExceedValidator(Func<object, object> valueToCompareFunc, MemberInfo member)
			: base(valueToCompareFunc, member, () => Messages.greaterthan_error) {
        }

        public override bool IsValid(IComparable value, IComparable valueToCompare)
        {
            if (valueToCompare == null)
                return false;

            return native.Comparer.GetComparisonResult(value, valueToCompare) > 0;
        }

        public override Comparison Comparison
        {
            get { return Comparison.GreaterThan; }
        }
    }
}